package com.bt.lms.ui.page.school_education.transfer_msg;

import com.bt.lms.ui.action.school_education.transferin_info.TransferInfoAddAction;
import com.bt.lms.ui.action.school_education.transferin_info.TransferInfoEditAction;
import com.bt.lms.ui.page.sys.style.BtnStyle;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Cursor;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;

/**
 * 学籍异动信息界面
 */
public class PageSchoolRegisterChangeMes extends VBox {

    private Integer baseWidth = 1200;



    public PageSchoolRegisterChangeMes(){


        //初始化学籍异动信息盒子
        initSchoolRegisterChangeBox();


    }

    /**
     * 初始化学籍异动信息盒子
     */
    private void initSchoolRegisterChangeBox() {
        VBox vBox = new VBox();
        VBox totalVBox = new VBox();
        Insets insets = new Insets(10);
        totalVBox.setPadding(insets);
        totalVBox.setPrefWidth(1200);

        HBox mesHBox = new HBox();
        mesHBox.setSpacing(700);
        Label studentBasic = new Label("招生计划A-班级1-灭霸学员学籍异动信息");
        studentBasic.setFont(Font.font("圆体", 20));

        mesHBox.getChildren().addAll(studentBasic);
        totalVBox.getChildren().add(mesHBox);

        Label SchoolRegisterChangeMes = new Label("学籍异动信息");
        SchoolRegisterChangeMes.setFont(Font.font("圆体",20));
        HBox hBox1 = new HBox();
        hBox1.setPrefWidth(1200);
        hBox1.setStyle("-fx-background-color: #cec9c9");
        hBox1.getChildren().add(SchoolRegisterChangeMes);
        totalVBox.getChildren().add(hBox1);
        totalVBox.setSpacing(10);

        ScrollPane scrollPane = new ScrollPane();
        scrollPane.setPrefWidth(1200);
        //设置滚动盒子只有竖向
        scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
        scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);

        HBox hBox = new HBox();
        hBox.setPrefWidth(baseWidth-200);
        Insets insets1 = new Insets(0,50,0,10);
        hBox.setPadding(insets1);
        hBox.setAlignment(Pos.CENTER_RIGHT);
        Button editBtn = new Button("💻编辑");
        hBox.getChildren().add(editBtn);
        totalVBox.getChildren().add(hBox);
        //按钮样式
        BtnStyle.saveBtn(editBtn);
        editBtn.setCursor(Cursor.HAND);

        //异动信息盒子
        HBox one = initSchoolRegisterChangeInfo();

        //事件
        TransferInfoEditAction transferInfoEditAction = new TransferInfoEditAction(totalVBox,one);
        editBtn.setOnAction(transferInfoEditAction);

        HBox addBox = new HBox();
        addBox.setPrefWidth(baseWidth);
        addBox.setPadding(new Insets(10));
        Button addBtn = new Button("继续添加");
        BtnStyle.addBtn(addBtn);
        addBox.setCursor(Cursor.HAND);
        addBox.getChildren().add(addBtn);

        //继续添加事件界面
        TransferInfoAddAction transferInfoAddAction = new TransferInfoAddAction(totalVBox,one);
        addBtn.setOnAction(transferInfoAddAction);

        scrollPane.setContent(vBox);
        totalVBox.getChildren().add(one);
        vBox.getChildren().add(totalVBox);
        vBox.getChildren().add(addBox);
        this.getChildren().add(scrollPane);
    }

    /**
     * 学籍异动信息盒子
     * @return
     */
    private HBox initSchoolRegisterChangeInfo(){
        HBox one = new HBox();
        one.setPrefWidth(baseWidth);
        one.setSpacing(10);

        VBox one1 = new VBox();
        one1.setPrefWidth(baseWidth/8);
        one1.setSpacing(10);
        Label variationSortLab = new Label("异动类别");
        Label variationCauseLab = new Label("异动原因");
        Label variationDataLab = new Label("异动日期");
        Label variationStateLab = new Label("异动说明");
        one1.getChildren().addAll(variationSortLab,variationCauseLab,variationDataLab,variationStateLab);
        one.getChildren().add(one1);

        VBox one2 = new VBox();
        one2.setPrefWidth(baseWidth/3);
        one2.setSpacing(10);
        Label variationSortLabMes = new Label("停复");
        Label variationCauseLabMes = new Label("停学后复学");
        Label variationDataLabMes = new Label("2012年7月6日");
        Label variationStateLabMes = new Label();
        one2.getChildren().addAll(variationSortLabMes,variationCauseLabMes,variationDataLabMes,variationStateLabMes);
        one.getChildren().add(one2);


        VBox one3 = new VBox();
        one3.setPrefWidth(baseWidth/7);
        one3.setSpacing(10);
        Label variationFrontStateLab = new Label("异动前学籍状态");
        Label variationQueenStateLab = new Label("异动后学籍状态");
        Label Lab = new Label();
        one3.getChildren().addAll(variationFrontStateLab,variationQueenStateLab,Lab);
        one.getChildren().add(one3);

        VBox one4 = new VBox();
        one4.setPrefWidth(baseWidth/3);
        one4.setSpacing(10);
        Label variationFrontStateLabMes = new Label("停学");
        Label variationQueenStateLabMes = new Label("在籍");
        Label approvalDataLabMes = new Label();
        Label labMes = new Label();
        one4.getChildren().addAll(variationFrontStateLabMes,variationQueenStateLabMes,approvalDataLabMes,labMes);
        one.getChildren().add(one4);

        VBox one5 = new VBox();
        one5.setSpacing(10);
        one5.setPrefWidth(baseWidth/3);
        Label choiceLab1 = new Label();
        Label choiceLab2 = new Label();
        Label choiceLab3 = new Label();
        Label choiceLab4 = new Label();
        one5.getChildren().addAll(choiceLab1,choiceLab2,choiceLab3,choiceLab4);
        one.getChildren().add(one5);


        return one;
    }
}
